import {$get, $post, $delete, $put, $postParms} from '@/utils/require'
import {UserApi} from "@/views/user/user.api";
export enum LabBorrowCheckApi{
  list = "/admin/labBorrow/list",
  updateStatus="/admin/labBorrow/updateStatus"
}

export const list = async (body?: any, params?: any) => {
  try {
    console.log("Api-body", body);
    console.log("Api-params", params);

    // 如果params不存在，则创建一个空对象
    if (!params) {
      params = {};
    }

    // 将body中的内容放入params
    Object.assign(params, body);
    return await $postParms(LabBorrowCheckApi.list, undefined, params);

  } catch (error) {
    console.error(error);
  }
};

export const updateStatus = async (id: number, selectedStatus: string, repairDescription?: string) => {
  try {
    const params = {
      id: id,
      status: selectedStatus,
    };

    // 发送POST请求
    return await $postParms(LabBorrowCheckApi.updateStatus, undefined, params);
  } catch (error) {
    console.error(error);
  }
};
